package za.co.smartmi.model;

import java.io.Serializable;
import java.util.Date;
import org.apache.commons.lang.StringUtils;
import za.co.smartmi.server.model.ActiveInactiveType;
import za.co.smartmi.util.AppConstants;

public class Client implements Serializable
{
	/** 
	 * This attribute maps to the column clientid in the client table.
	 */
	protected Integer clientid;

	/** 
	 * This attribute maps to the column firstname in the client table.
	 */
	protected String firstname;

	/** 
	 * This attribute maps to the column surname in the client table.
	 */
	protected String surname;

	/** 
	 * This attribute maps to the column idno in the client table.
	 */
	protected String idno;

	/** 
	 * This attribute maps to the column dob in the client table.
	 */
	protected Date dob;

	/** 
	 * This attribute maps to the column title in the client table.
	 */
	protected String title;

	/** 
	 * This attribute maps to the column mobile in the client table.
	 */
	protected String mobile;

	/** 
	 * This attribute maps to the column hphone in the client table.
	 */
	protected String hphone;

	/** 
	 * This attribute maps to the column wphone in the client table.
	 */
	protected String wphone;

	/** 
	 * This attribute maps to the column email1 in the client table.
	 */
	protected String email1;

	/** 
	 * This attribute maps to the column email2 in the client table.
	 */
	protected String email2;

	/** 
	 * This attribute maps to the column postaddr1 in the client table.
	 */
	protected String postaddr1;

	/** 
	 * This attribute maps to the column postaddr2 in the client table.
	 */
	protected String postaddr2;

	/** 
	 * This attribute maps to the column postaddr3 in the client table.
	 */
	protected String postaddr3;

	/** 
	 * This attribute maps to the column postcode in the client table.
	 */
	protected String postcode;

	/** 
	 * This attribute maps to the column physaddr1 in the client table.
	 */
	protected String physaddr1;

	/** 
	 * This attribute maps to the column physaddr2 in the client table.
	 */
	protected String physaddr2;

	/** 
	 * This attribute maps to the column physaddr3 in the client table.
	 */
	protected String physaddr3;

	/** 
	 * This attribute maps to the column notes in the client table.
	 */
	protected String notes;

	/** 
	 * This attribute maps to the column type in the client table.
	 */
	protected String type;

	/** 
	 * This attribute maps to the column status in the client table.
	 */
	protected String status;

	/** 
	 * This attribute maps to the column startdate in the client table.
	 */
	protected Date startdate;

	/** 
	 * This attribute maps to the column enddate in the client table.
	 */
	protected Date enddate;

	/** 
	 * This attribute maps to the column csys in the client table.
	 */
	protected String csys;

	/** 
	 * This attribute maps to the column cdate in the client table.
	 */
	protected Date cdate;

	/** 
	 * This attribute maps to the column usys in the client table.
	 */
	protected String usys;

	/** 
	 * This attribute maps to the column udate in the client table.
	 */
	protected Date udate;

	/**
	 * Method 'Client'
	 * 
	 */
	public Client()
	{
	}

	/**
	 * Method 'getClientid'
	 * 
	 * @return Integer
	 */
	public Integer getClientid()
	{
		return clientid;
	}

	/**
	 * Method 'setClientid'
	 * 
	 * @param clientid
	 */
	public void setClientid(Integer clientid)
	{
		this.clientid = clientid;
	}

	/**
	 * Method 'getFirstname'
	 * 
	 * @return String
	 */
	public String getFirstname()
	{
		return firstname;
	}

	/**
	 * Method 'setFirstname'
	 * 
	 * @param firstname
	 */
	public void setFirstname(String firstname)
	{
		this.firstname = firstname;
	}

	/**
	 * Method 'getSurname'
	 * 
	 * @return String
	 */
	public String getSurname()
	{
		return surname;
	}

	/**
	 * Method 'setSurname'
	 * 
	 * @param surname
	 */
	public void setSurname(String surname)
	{
		this.surname = surname;
	}

	/**
	 * Method 'getIdno'
	 * 
	 * @return String
	 */
	public String getIdno()
	{
		return idno;
	}

	/**
	 * Method 'setIdno'
	 * 
	 * @param idno
	 */
	public void setIdno(String idno)
	{
		this.idno = idno;
	}

	/**
	 * Method 'getDob'
	 * 
	 * @return Date
	 */
	public Date getDob()
	{
		return dob;
	}

	/**
	 * Method 'setDob'
	 * 
	 * @param dob
	 */
	public void setDob(Date dob)
	{
		this.dob = dob;
	}

	/**
	 * Method 'getTitle'
	 * 
	 * @return String
	 */
	public String getTitle()
	{
		return title;
	}

	/**
	 * Method 'setTitle'
	 * 
	 * @param title
	 */
	public void setTitle(String title)
	{
		this.title = title;
	}

	/**
	 * Method 'getMobile'
	 * 
	 * @return String
	 */
	public String getMobile()
	{
		return mobile;
	}

	/**
	 * Method 'setMobile'
	 * 
	 * @param mobile
	 */
	public void setMobile(String mobile)
	{
		this.mobile = mobile;
	}

	/**
	 * Method 'getHphone'
	 * 
	 * @return String
	 */
	public String getHphone()
	{
		return hphone;
	}

	/**
	 * Method 'setHphone'
	 * 
	 * @param hphone
	 */
	public void setHphone(String hphone)
	{
		this.hphone = hphone;
	}

	/**
	 * Method 'getWphone'
	 * 
	 * @return String
	 */
	public String getWphone()
	{
		return wphone;
	}

	/**
	 * Method 'setWphone'
	 * 
	 * @param wphone
	 */
	public void setWphone(String wphone)
	{
		this.wphone = wphone;
	}

	/**
	 * Method 'getEmail1'
	 * 
	 * @return String
	 */
	public String getEmail1()
	{
		return email1;
	}

	/**
	 * Method 'setEmail1'
	 * 
	 * @param email1
	 */
	public void setEmail1(String email1)
	{
		this.email1 = email1;
	}

	/**
	 * Method 'getEmail2'
	 * 
	 * @return String
	 */
	public String getEmail2()
	{
		return email2;
	}

	/**
	 * Method 'setEmail2'
	 * 
	 * @param email2
	 */
	public void setEmail2(String email2)
	{
		this.email2 = email2;
	}

	/**
	 * Method 'getPostaddr1'
	 * 
	 * @return String
	 */
	public String getPostaddr1()
	{
		return postaddr1;
	}

	/**
	 * Method 'setPostaddr1'
	 * 
	 * @param postaddr1
	 */
	public void setPostaddr1(String postaddr1)
	{
		this.postaddr1 = postaddr1;
	}

	/**
	 * Method 'getPostaddr2'
	 * 
	 * @return String
	 */
	public String getPostaddr2()
	{
		return postaddr2;
	}

	/**
	 * Method 'setPostaddr2'
	 * 
	 * @param postaddr2
	 */
	public void setPostaddr2(String postaddr2)
	{
		this.postaddr2 = postaddr2;
	}

	/**
	 * Method 'getPostaddr3'
	 * 
	 * @return String
	 */
	public String getPostaddr3()
	{
		return postaddr3;
	}

	/**
	 * Method 'setPostaddr3'
	 * 
	 * @param postaddr3
	 */
	public void setPostaddr3(String postaddr3)
	{
		this.postaddr3 = postaddr3;
	}

	/**
	 * Method 'getPostcode'
	 * 
	 * @return String
	 */
	public String getPostcode()
	{
		return postcode;
	}

	/**
	 * Method 'setPostcode'
	 * 
	 * @param postcode
	 */
	public void setPostcode(String postcode)
	{
		this.postcode = postcode;
	}

	/**
	 * Method 'getPhysaddr1'
	 * 
	 * @return String
	 */
	public String getPhysaddr1()
	{
		return physaddr1;
	}

	/**
	 * Method 'setPhysaddr1'
	 * 
	 * @param physaddr1
	 */
	public void setPhysaddr1(String physaddr1)
	{
		this.physaddr1 = physaddr1;
	}

	/**
	 * Method 'getPhysaddr2'
	 * 
	 * @return String
	 */
	public String getPhysaddr2()
	{
		return physaddr2;
	}

	/**
	 * Method 'setPhysaddr2'
	 * 
	 * @param physaddr2
	 */
	public void setPhysaddr2(String physaddr2)
	{
		this.physaddr2 = physaddr2;
	}

	/**
	 * Method 'getPhysaddr3'
	 * 
	 * @return String
	 */
	public String getPhysaddr3()
	{
		return physaddr3;
	}

	/**
	 * Method 'setPhysaddr3'
	 * 
	 * @param physaddr3
	 */
	public void setPhysaddr3(String physaddr3)
	{
		this.physaddr3 = physaddr3;
	}

	/**
	 * Method 'getNotes'
	 * 
	 * @return String
	 */
	public String getNotes()
	{
		return notes;
	}

	/**
	 * Method 'setNotes'
	 * 
	 * @param notes
	 */
	public void setNotes(String notes)
	{
		this.notes = notes;
	}

	/**
	 * Method 'getType'
	 * 
	 * @return String
	 */
	public String getType()
	{
		return type;
	}

	/**
	 * Method 'setType'
	 * 
	 * @param type
	 */
	public void setType(String type)
	{
		this.type = type;
	}

	/**
	 * Method 'getStatus'
	 * 
	 * @return String
	 */
	public String getStatus()
	{
		return status;
	}

	/**
	 * Method 'setStatus'
	 * 
	 * @param status
	 */
	public void setStatus(String status)
	{
		this.status = status;
	}

	/**
	 * Method 'getStartdate'
	 * 
	 * @return Date
	 */
	public Date getStartdate()
	{
		return startdate;
	}

	/**
	 * Method 'setStartdate'
	 * 
	 * @param startdate
	 */
	public void setStartdate(Date startdate)
	{
		this.startdate = startdate;
	}

	/**
	 * Method 'getEnddate'
	 * 
	 * @return Date
	 */
	public Date getEnddate()
	{
		return enddate;
	}

	/**
	 * Method 'setEnddate'
	 * 
	 * @param enddate
	 */
	public void setEnddate(Date enddate)
	{
		this.enddate = enddate;
	}

	/**
	 * Method 'getCsys'
	 * 
	 * @return String
	 */
	public String getCsys()
	{
		return csys;
	}

	/**
	 * Method 'setCsys'
	 * 
	 * @param csys
	 */
	public void setCsys(String csys)
	{
		this.csys = csys;
	}

	/**
	 * Method 'getCdate'
	 * 
	 * @return Date
	 */
	public Date getCdate()
	{
		return cdate;
	}

	/**
	 * Method 'setCdate'
	 * 
	 * @param cdate
	 */
	public void setCdate(Date cdate)
	{
		this.cdate = cdate;
	}

	/**
	 * Method 'getUsys'
	 * 
	 * @return String
	 */
	public String getUsys()
	{
		return usys;
	}

	/**
	 * Method 'setUsys'
	 * 
	 * @param usys
	 */
	public void setUsys(String usys)
	{
		this.usys = usys;
	}

	/**
	 * Method 'getUdate'
	 * 
	 * @return Date
	 */
	public Date getUdate()
	{
		return udate;
	}

	/**
	 * Method 'setUdate'
	 * 
	 * @param udate
	 */
	public void setUdate(Date udate)
	{
		this.udate = udate;
	}

	/**
	 * Method 'equals'
	 * 
	 * @param _other
	 * @return boolean
	 */
	public boolean equals(Object _other)
	{
		if (_other == null) {
			return false;
		}
		
		if (_other == this) {
			return true;
		}
		
		if (!(_other instanceof Client)) {
			return false;
		}
		
		final Client _cast = (Client) _other;
		if (clientid == null ? _cast.clientid != clientid : !clientid.equals( _cast.clientid )) {
			return false;
		}
		
		if (firstname == null ? _cast.firstname != firstname : !firstname.equals( _cast.firstname )) {
			return false;
		}
		
		if (surname == null ? _cast.surname != surname : !surname.equals( _cast.surname )) {
			return false;
		}
		
		if (idno == null ? _cast.idno != idno : !idno.equals( _cast.idno )) {
			return false;
		}
		
		if (dob == null ? _cast.dob != dob : !dob.equals( _cast.dob )) {
			return false;
		}
		
		if (title == null ? _cast.title != title : !title.equals( _cast.title )) {
			return false;
		}
		
		if (mobile == null ? _cast.mobile != mobile : !mobile.equals( _cast.mobile )) {
			return false;
		}
		
		if (hphone == null ? _cast.hphone != hphone : !hphone.equals( _cast.hphone )) {
			return false;
		}
		
		if (wphone == null ? _cast.wphone != wphone : !wphone.equals( _cast.wphone )) {
			return false;
		}
		
		if (email1 == null ? _cast.email1 != email1 : !email1.equals( _cast.email1 )) {
			return false;
		}
		
		if (email2 == null ? _cast.email2 != email2 : !email2.equals( _cast.email2 )) {
			return false;
		}
		
		if (postaddr1 == null ? _cast.postaddr1 != postaddr1 : !postaddr1.equals( _cast.postaddr1 )) {
			return false;
		}
		
		if (postaddr2 == null ? _cast.postaddr2 != postaddr2 : !postaddr2.equals( _cast.postaddr2 )) {
			return false;
		}
		
		if (postaddr3 == null ? _cast.postaddr3 != postaddr3 : !postaddr3.equals( _cast.postaddr3 )) {
			return false;
		}
		
		if (postcode == null ? _cast.postcode != postcode : !postcode.equals( _cast.postcode )) {
			return false;
		}
		
		if (physaddr1 == null ? _cast.physaddr1 != physaddr1 : !physaddr1.equals( _cast.physaddr1 )) {
			return false;
		}
		
		if (physaddr2 == null ? _cast.physaddr2 != physaddr2 : !physaddr2.equals( _cast.physaddr2 )) {
			return false;
		}
		
		if (physaddr3 == null ? _cast.physaddr3 != physaddr3 : !physaddr3.equals( _cast.physaddr3 )) {
			return false;
		}
		
		if (notes == null ? _cast.notes != notes : !notes.equals( _cast.notes )) {
			return false;
		}
		
		if (type == null ? _cast.type != type : !type.equals( _cast.type )) {
			return false;
		}
		
		if (status == null ? _cast.status != status : !status.equals( _cast.status )) {
			return false;
		}
		
		if (startdate == null ? _cast.startdate != startdate : !startdate.equals( _cast.startdate )) {
			return false;
		}
		
		if (enddate == null ? _cast.enddate != enddate : !enddate.equals( _cast.enddate )) {
			return false;
		}
		
		if (csys == null ? _cast.csys != csys : !csys.equals( _cast.csys )) {
			return false;
		}
		
		if (cdate == null ? _cast.cdate != cdate : !cdate.equals( _cast.cdate )) {
			return false;
		}
		
		if (usys == null ? _cast.usys != usys : !usys.equals( _cast.usys )) {
			return false;
		}
		
		if (udate == null ? _cast.udate != udate : !udate.equals( _cast.udate )) {
			return false;
		}
		
		return true;
	}

	/**
	 * Method 'hashCode'
	 * 
	 * @return int
	 */
	public int hashCode()
	{
		int _hashCode = 0;
		if (clientid != null) {
			_hashCode = 29 * _hashCode + clientid.hashCode();
		}
		
		if (firstname != null) {
			_hashCode = 29 * _hashCode + firstname.hashCode();
		}
		
		if (surname != null) {
			_hashCode = 29 * _hashCode + surname.hashCode();
		}
		
		if (idno != null) {
			_hashCode = 29 * _hashCode + idno.hashCode();
		}
		
		if (dob != null) {
			_hashCode = 29 * _hashCode + dob.hashCode();
		}
		
		if (title != null) {
			_hashCode = 29 * _hashCode + title.hashCode();
		}
		
		if (mobile != null) {
			_hashCode = 29 * _hashCode + mobile.hashCode();
		}
		
		if (hphone != null) {
			_hashCode = 29 * _hashCode + hphone.hashCode();
		}
		
		if (wphone != null) {
			_hashCode = 29 * _hashCode + wphone.hashCode();
		}
		
		if (email1 != null) {
			_hashCode = 29 * _hashCode + email1.hashCode();
		}
		
		if (email2 != null) {
			_hashCode = 29 * _hashCode + email2.hashCode();
		}
		
		if (postaddr1 != null) {
			_hashCode = 29 * _hashCode + postaddr1.hashCode();
		}
		
		if (postaddr2 != null) {
			_hashCode = 29 * _hashCode + postaddr2.hashCode();
		}
		
		if (postaddr3 != null) {
			_hashCode = 29 * _hashCode + postaddr3.hashCode();
		}
		
		if (postcode != null) {
			_hashCode = 29 * _hashCode + postcode.hashCode();
		}
		
		if (physaddr1 != null) {
			_hashCode = 29 * _hashCode + physaddr1.hashCode();
		}
		
		if (physaddr2 != null) {
			_hashCode = 29 * _hashCode + physaddr2.hashCode();
		}
		
		if (physaddr3 != null) {
			_hashCode = 29 * _hashCode + physaddr3.hashCode();
		}
		
		if (notes != null) {
			_hashCode = 29 * _hashCode + notes.hashCode();
		}
		
		if (type != null) {
			_hashCode = 29 * _hashCode + type.hashCode();
		}
		
		if (status != null) {
			_hashCode = 29 * _hashCode + status.hashCode();
		}
		
		if (startdate != null) {
			_hashCode = 29 * _hashCode + startdate.hashCode();
		}
		
		if (enddate != null) {
			_hashCode = 29 * _hashCode + enddate.hashCode();
		}
		
		if (csys != null) {
			_hashCode = 29 * _hashCode + csys.hashCode();
		}
		
		if (cdate != null) {
			_hashCode = 29 * _hashCode + cdate.hashCode();
		}
		
		if (usys != null) {
			_hashCode = 29 * _hashCode + usys.hashCode();
		}
		
		if (udate != null) {
			_hashCode = 29 * _hashCode + udate.hashCode();
		}
		
		return _hashCode;
	}

	/**
	 * Method 'createPk'
	 * 
	 * @return ClientPk
	 */
	public ClientPk createPk()
	{
		return new ClientPk(clientid);
	}

	/**
	 * Method 'toString'
	 * 
	 * @return String
	 */
	public String toString()
	{
		StringBuffer ret = new StringBuffer();
		ret.append( "za.co.smartmi.dto.Client: " );
		ret.append( "clientid=" + clientid );
		ret.append( ", firstname=" + firstname );
		ret.append( ", surname=" + surname );
		ret.append( ", idno=" + idno );
		ret.append( ", dob=" + dob );
		ret.append( ", title=" + title );
		ret.append( ", mobile=" + mobile );
		ret.append( ", hphone=" + hphone );
		ret.append( ", wphone=" + wphone );
		ret.append( ", email1=" + email1 );
		ret.append( ", email2=" + email2 );
		ret.append( ", postaddr1=" + postaddr1 );
		ret.append( ", postaddr2=" + postaddr2 );
		ret.append( ", postaddr3=" + postaddr3 );
		ret.append( ", postcode=" + postcode );
		ret.append( ", physaddr1=" + physaddr1 );
		ret.append( ", physaddr2=" + physaddr2 );
		ret.append( ", physaddr3=" + physaddr3 );
		ret.append( ", notes=" + notes );
		ret.append( ", type=" + type );
		ret.append( ", status=" + status );
		ret.append( ", startdate=" + startdate );
		ret.append( ", enddate=" + enddate );
		ret.append( ", csys=" + csys );
		ret.append( ", cdate=" + cdate );
		ret.append( ", usys=" + usys );
		ret.append( ", udate=" + udate );
		return ret.toString();
	}

    public Client(String firstname, String surname, String idno, Date dob, String status) {
        this.firstname = firstname;
        this.surname = surname;
        this.idno = idno;
        this.dob = dob;
        this.status = status;
    }
       
    public String getStatusFormatted() {
        return ((!StringUtils.isEmpty(status) && status.equalsIgnoreCase(ActiveInactiveType.ACTIVE.get())) ? AppConstants.STATUS_ACTIVE : AppConstants.STATUS_INACTIVE);
    }
        

}
